package com.example.x7demo;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.util.Log;

import com.smwl.smsdk.abstrat.SMInitListener;
import com.smwl.smsdk.app.SMPlatformManager;

public class MainActivity extends AppCompatActivity {
    private static final String TAG = "x7syplugin";
    private static final String RSA = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC58hC/acPrD5AeZ04/FV9entfo0Gyliv236h9Kk3Nv245OWzBn9m16IKldTK7H7gePCCSc0b4CjgUUjYJlVHbd0ZKJTBJguBtsw+x35ptcbCLudmlhQjBd/j2vPwthJAwUVaENxATGKIbSsLNRoi63+baVHa3LRClcp4R5TlGuQwIDAQAB";
    private static final String APPKEY = "445ce05b60d81fdb96eaf7a8977e6fb2";
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        this.initX7Sdk();
    }

    void initX7Sdk(){
        MainActivity.this.runOnUiThread(new Runnable() {
            @Override
            public void run() {
            //程序的入口执行初始化操作：一般放在游戏入口的activity里面用主线程调用
            SMPlatformManager.getInstance().init(MainActivity.this,
                    APPKEY, new SMInitListener() {
                        @Override
                        public void onSuccess() {
                            Log.d(TAG, "游戏初始化成功");
                            System.out.println("游戏初始化成功");
                        }

                        @Override
                        public void onFail(String reason) {
                            System.out.println("游戏初始化失败：" + reason);
                        }
                    });
            }
        });
    }
}
